﻿using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media.Imaging;
using System.Windows.Media;
using System.ComponentModel;

namespace TMTemplate
{
	public partial class Image : UserControl
	{
		public Image()
		{
			InitializeComponent();
            MouseEnter += new MouseEventHandler((s, e) => { VisualStateManager.GoToState(this, "Enter", false); });
            MouseLeave += new MouseEventHandler((s, e) => { VisualStateManager.GoToState(this, "Normal", false); });
		}

        public static readonly DependencyProperty ImageProperty =
    DependencyProperty.Register("Source", typeof(ImageSource), typeof(Image), new PropertyMetadata(null, SourcePropertyChanged));

        private static void SourcePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ((Image)d).MainImage.Source = ((Image)d).Source;
        }
        [Category("Common Properties")]
        public ImageSource Source
        {
            get { return (ImageSource)GetValue(ImageProperty); }
            set { SetValue(ImageProperty, value); }
        }
	}
}